using System;
using Microsoft.SPOT;
using Netduino4Fun.Framework.ElectronicBrick;
using SecretLabs.NETMF.Hardware.NetduinoPlus;
using Netduino4Fun.Framework;
using System.Threading;

namespace Netduino4Fun.Robot
{
    public class RobotTestTurnController
    {
        PushButton button = new PushButton(Pins.GPIO_PIN_D8);
        WheelController motorShield = new WheelController();
        bool left = false;

        public void Start()
        {

            this.button.Push += new Microsoft.SPOT.Hardware.NativeEventHandler(button_Push);

            Thread.Sleep(Timeout.Infinite);
        }

        void button_Push(uint data1, uint data2, DateTime time)
        {
            Debug.Print("Button click");

            while (true)
            {
                Thread.Sleep(1000);

                //left = !left;

                if (left)
                    motorShield.Turn90Left();
                else
                    motorShield.Turn90Right();
            }
        }
    }
}
